import Router from 'vue-router'
import Vue from 'vue'
// import home from '../view/home'
// import monitor from '../view/fault/modules/index'
// import screen from '../view/screen'
// import query from '../view/fault/modules/query'
// import analysis from '../view/fault/modules/analysis'
// import operation from '../view/operation'
// import setting from '../view/setting'
// import warning from '../view/warning'
// import knowledge from '../view/knowledge'
// import share from '../view/share'
// import network from '../view/network'
import login from '../view/login'
Vue.use(Router)

// 防止跳转同一路径出异常
const originalPush = Router.prototype.push
Router.prototype.push = function push(location, onResolve, onReject) {
  if (onResolve || onReject) {return originalPush.call(this, location, onResolve, onReject)}
  return originalPush.call(this, location).catch(err => err)
}

const defaultPath = '/home'

const router = new Router({
  mode: 'history',
  routes: [
    {
      path: '/',
      redirect: defaultPath,
      meta: {
        isDefalut: true
      }
    },
    {
      path: '/login',
      name: 'login',
      component: login,
      meta: {
        isFull: true,
        isDefalut: true
      }
    }
  ]
})

export default router